![]() |
MQTT C Client Libraries Internals
|
Threading related functions. More...
#include "Thread.h"#include "Log.h"#include "StackTrace.h"#include <errno.h>#include <unistd.h>#include <sys/time.h>#include <fcntl.h>#include <stdio.h>#include <sys/stat.h>#include <limits.h>#include <stdlib.h>#include "OsWrapper.h"
Functions | |
| thread_type | Thread_start (thread_fn fn, void *parameter) |
| Start a new thread. More... | |
| mutex_type | Thread_create_mutex (void) |
| Create a new mutex. More... | |
| int | Thread_lock_mutex (mutex_type mutex) |
| Lock a mutex which has alrea. More... | |
| int | Thread_unlock_mutex (mutex_type mutex) |
| Unlock a mutex which has already been locked. More... | |
| void | Thread_destroy_mutex (mutex_type mutex) |
| Destroy a mutex which has already been created. More... | |
| thread_id_type | Thread_getid (void) |
| Get the thread id of the thread from which this function is called. More... | |
| sem_type | Thread_create_sem (void) |
| Create a new semaphore. More... | |
| int | Thread_wait_sem (sem_type sem, int timeout) |
| Wait for a semaphore to be posted, or timeout. More... | |
| int | Thread_check_sem (sem_type sem) |
| Check to see if a semaphore has been posted, without waiting The semaphore will be unchanged, if the return value is false. More... | |
| int | Thread_post_sem (sem_type sem) |
| Post a semaphore. More... | |
| int | Thread_destroy_sem (sem_type sem) |
| Destroy a semaphore which has already been created. More... | |
| cond_type | Thread_create_cond (void) |
| Create a new condition variable. More... | |
| int | Thread_signal_cond (cond_type condvar) |
| Signal a condition variable. More... | |
| int | Thread_wait_cond (cond_type condvar, int timeout) |
| Wait with a timeout (seconds) for condition variable. More... | |
| int | Thread_destroy_cond (cond_type condvar) |
| Destroy a condition variable. More... | |
Threading related functions.
Used to create platform independent threading functions
| int Thread_check_sem | ( | sem_type | sem | ) |
Check to see if a semaphore has been posted, without waiting The semaphore will be unchanged, if the return value is false.
The semaphore will have been decremented, if the return value is true.
| sem | the semaphore |
| cond_type Thread_create_cond | ( | void | ) |
Create a new condition variable.

| mutex_type Thread_create_mutex | ( | void | ) |
Create a new mutex.
| sem_type Thread_create_sem | ( | void | ) |
Create a new semaphore.
| int Thread_destroy_cond | ( | cond_type | condvar | ) |
Destroy a condition variable.
| void Thread_destroy_mutex | ( | mutex_type | mutex | ) |
Destroy a mutex which has already been created.
| mutex | the mutex |
| int Thread_destroy_sem | ( | sem_type | sem | ) |
Destroy a semaphore which has already been created.
| sem | the semaphore |
| thread_id_type Thread_getid | ( | void | ) |
Get the thread id of the thread from which this function is called.
| int Thread_lock_mutex | ( | mutex_type | mutex | ) |
Lock a mutex which has alrea.
| int Thread_post_sem | ( | sem_type | sem | ) |
Post a semaphore.
| sem | the semaphore |
| int Thread_signal_cond | ( | cond_type | condvar | ) |
Signal a condition variable.
| thread_type Thread_start | ( | thread_fn | fn, |
| void * | parameter | ||
| ) |
Start a new thread.
| fn | the function to run, must be of the correct signature |
| parameter | pointer to the function parameter, can be NULL |
| int Thread_unlock_mutex | ( | mutex_type | mutex | ) |
Unlock a mutex which has already been locked.
| mutex | the mutex |
| int Thread_wait_cond | ( | cond_type | condvar, |
| int | timeout | ||
| ) |
Wait with a timeout (seconds) for condition variable.
| int Thread_wait_sem | ( | sem_type | sem, |
| int | timeout | ||
| ) |
Wait for a semaphore to be posted, or timeout.
| sem | the semaphore |
| timeout | the maximum time to wait, in milliseconds |
1.8.5